package Homework1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Jakim
 */
public class TestCourse {

    public static void main(String[] args) {

        float arithmeticalMean;
        String studentName;
        String studentNumber;
        String facultySubject;
        BufferedReader bfReader = null;
        Student tmpStudent;

        Course cscb302 = new Course();

//        cscb302.addStudent("Петър");
//        Student temp = cscb302.getStudent();
//        System.out.println("Name: " + temp.getName());
        bfReader = new BufferedReader(new InputStreamReader(System.in));

        for (int i = 0; i < 5; i++) {
            try {
                System.out.println("Enter Student Name: ");
                studentName = bfReader.readLine();
                System.out.println("Enter Student Number: ");
                studentNumber = bfReader.readLine();
                System.out.println("Enter Student Faculty Subject: ");
                facultySubject = bfReader.readLine();
                System.out.println("Enter Student Aritmetical Mean: ");
                arithmeticalMean = Float.parseFloat(bfReader.readLine());

                tmpStudent = cscb302.addStudent(studentName, studentNumber);
                tmpStudent.setArithmeticalMean(arithmeticalMean);
                tmpStudent.setUniversitySubject(facultySubject);

            } catch (AlreadyInTheMapException ex) {
                System.out.println(ex.getmErrorMessage());

            } catch (IOException ex) {
                Logger.getLogger(TestCourse.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        try {
            System.out.println("------------------------------------------");
            System.out.println("Enter Student Number: ");
            studentNumber = bfReader.readLine();
            System.out.println(cscb302.getStudent(studentNumber));
            bfReader.close();

        } catch (NotInTheMapException ex) {
            System.out.println(ex.getmErrorMessage());

        } catch (IOException ex) {
            Logger.getLogger(TestCourse.class.getName()).log(Level.SEVERE, null, ex);

        }

        cscb302.SeparateSudents();
        System.out.println("------------------------------------------");
        System.out.println("Lame Students: ");
        cscb302.printAllLameStudents();
        System.out.println("Smart Students: ");
        cscb302.printAllSmartStudents();

    }
}
